export function showToast(title = '', duration = 2000, icon = 'none', ) {
	return new Promise((resolve, reject) => uni.showToast({
		title,
		duration,
		icon,
		success: () => setTimeout(() => resolve(), duration),
		fail: () => reject()
	}))
};

export function showSuccess(title = '操作成功', icon = 'success', duration = 2000, mask = true) {
	return new Promise((resolve, reject) => uni.showToast({
		title,
		duration,
		icon,
		mask,
		success: () => setTimeout(() => resolve(), duration),
		fail: () => reject()
	}))
};

export function showLoading(title = '加载中...', mask = true) {
	return uni.showLoading({
		title,
		mask
	})
};

export function showModal(text, showCancel = true, title = "提示", confirmText = '确定') {
	return new Promise((resolve, reject) => uni.showModal({
		title,
		content: text, 
		showCancel,
		confirmText,
		confirmColor: '#FF2615',
		success: (res) => res.confirm ? resolve(true) : resolve(false)
	}))
}